package demo01;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;

import org.apache.commons.io.FileUtils;

import cn.hutool.db.ds.tomcat.TomcatDSFactory;


/*����sort.txt*/
public class zuoye01 {
	public static void main(String[] args) throws Exception{
//		FileUtils.copyFile(new File("E:\\1437970061\\sort.txt"), new File("sort.txt"));
	
		ArrayList<String> list=new ArrayList<>();
	BufferedReader br=new BufferedReader(new FileReader("sort.txt"));
	String len=null;
	while((len=br.readLine())!=null)
	{
		list.add(len);
	}
	List<String> collect = list.stream().sorted().collect(Collectors.toList());
	System.out.println(collect);
	FileWriter fw=new FileWriter("sort.txt");
	BufferedWriter wr=new BufferedWriter(fw);
	for(String s:collect)
	{
		wr.write(s);
		wr.newLine();
	}
	wr.close();
	}
}
